package com.shanzmoo.db.store.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.shanzmoo.db.store.entity.StorePurchaseBillEntity;
import com.shanzmoo.db.store.entity.bo.StoreReceiveSkuSelectBO;
import com.shanzmoo.db.store.entity.vo.StorePurchaseBillVO;
import com.shanzmoo.db.store.entity.query.StorePurchaseBillQuery;
import com.shanzmoo.db.store.mapper.StorePurchaseBillMapper;
import com.shanzmoo.db.store.service.IStorePurchaseBillService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 仓库采购单 服务实现类
 *
 * @author xueqz 2021-03-07
 */
@Service
public class StorePurchaseBillServiceImpl extends ServiceImpl<StorePurchaseBillMapper, StorePurchaseBillEntity>
        implements IStorePurchaseBillService {

    @Override
    public List<StorePurchaseBillVO> queryPageList(StorePurchaseBillQuery query) {
        return baseMapper.queryPageList(query);
    }

    @Override
    public Boolean judgeDelSupplier(Integer id) {
        List<StorePurchaseBillEntity> list = baseMapper.selectList(new QueryWrapper<StorePurchaseBillEntity>()
                .eq("supplier_id", id)
                .eq("deleted",false));
        return CollUtil.isNotEmpty(list);
    }

    @Override
    public List<StoreReceiveSkuSelectBO> getReceiveList(String originOrder) {
        return baseMapper.getReceiveList(originOrder);
    }
}
